<template>
  <div class="sign">
    <div class="mask">
      <el-row :gutter="20">
        <el-col :span="12">
          <div class="img">
            <img
              src="https://hooray.gitee.io/fantastic-admin-pro-example/assets/login-banner-a565fac8.png"
            />
          </div>
        </el-col>
        <el-col :span="12">
          <div class="login_right">
            <h3>忘记密码了? 😶‍🌫️</h3>
            <el-form ref="form" :rules="rules" :model="form">
              <el-form-item prop="usernmae" label-width="70px">
                <b> 用户名 </b
                ><el-input placeholder="用户名" v-model="form.usernmae" />
              </el-form-item>
              <el-form-item label-width="70px" prop="password">
                <b> 原密码 </b>
                <el-input v-model="form.password" placeholder="请输入密码" />
              </el-form-item>
              <el-form-item label-width="70px" prop="newpassword">
                <b> 新密码 </b>
                <el-input v-model="form.newpassword" placeholder="请输入密码" />
              </el-form-item>
              <el-form-item class="bot">
                <el-button type="primary" @click="$router.push('/login')"
                  >返回登陆</el-button
                >
                <el-button type="primary" @click="change()">修改密码</el-button>
              </el-form-item>
            </el-form>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
 
 <script>
import { HttpChange } from "api";
import { ElMessage } from "element-plus";
export default {
  data() {
    return {
      form: {
        usernmae: "",
        password: "",
        newpassword: "",
      },
      rules: {
        usernmae: [
          {
            required: true,
            message: "please enter a User Name ",
            trigger: "blur",
          },
          {
            min: 3,
            max: 5,
            message: "The length is 3 to 5 ",
            trigger: "blur",
          },
        ],
        password: [
          {
            required: true,
            message: "please enter the password ",
            trigger: "blur",
          },
        ],
      },
    };
  },
  methods: {
    async change() {
      const res = await HttpChange({ ...this.form });
      console.log(res.data, this.form);
      ElMessage({
        type: "warning",
        message: res.data.msg,
      });
    },
    // 重置数据
    resetForm(form) {
      this.$refs[form].resetFields();
    },
  },
};
</script>


 <style scoped lang='scss'>
a {
  text-decoration: none;

  cursor: pointer;
}
.sign {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 40%;
  left: 0px;
  background-image: url("../../assets/img/change.jpg");
  background-repeat: repeat-x;
  transition: 2s;
  background-size: 100% 60%;
}
h3 {
  line-height: 100px;
  font-size: 30px;
}
.mask {
  .el-input {
    height: 40px;
    width: 280px;
  }
  b {
    width: 60px;
    float: left;
    font-weight: normal;
    font-size: 18px;
  }
  color: #000;
  background-color: rgba(141, 139, 139, 0.3);
  border: solid 1px #ccc;
  width: 900px;
  height: 500px;
  position: fixed;
  top: 50%;
  overflow: hidden;
  border-radius: 20px;
  left: 50%;
  transform: translate(-50%, -50%);
  // box-shadow: 0px -2px 30px #ccc;
}
.img {
  width: 100%;
  height: 500px;
  background-color: rgba(240, 248, 255, 0.712);
  img {
    margin: 10px;
    margin-left: -30px;
    width: 120%;
    height: 90%;
  }
}
.login_right {
  padding: 10px;
}
.bot {
  margin-top: 30px;
  margin-left: 130px;
}

.login_right a {
  float: right;
  margin-right: 10px;
  font-size: 13px;
}
h5 {
  text-align: center;
}
</style>